package com.sim.contact.tool.contacts;

import android.provider.ContactsContract;

public class Phone {
     private String number;
     private int type;
     /**SIM卡类型*/
     public final static int SIM=100000;
     
     public String getNumber() {
         return number;
     }
 
     public void setNumber(String number) {
         this.number = number;
     }
 
     public int getType() {
         return type;
     }
 
     public void setType(int type) {
         this.type = type;
     }
 
     public Phone(String n, int t) {
         this.number = n;
         this.type = t;
     }
    /**
     * format 手机,139xxxxxx
     * @return
     */
    public String toString(){
    	String rslt="";
    	rslt+=getTypeName();
		rslt+=":";
		rslt+=(number==null?"":number);
    	
    	return rslt; 
    }
    
    private String getTypeName(){
    	String name="";
    	switch (type) {
		case ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE:
			name = "手机";
			break;
		case ContactsContract.CommonDataKinds.Phone.TYPE_WORK:
			name = "单位";
			break;
		case ContactsContract.CommonDataKinds.Phone.TYPE_HOME:
			name = "住宅";
			break;
		case ContactsContract.CommonDataKinds.Phone.TYPE_MAIN:
			name = "总机";
			break;
		case ContactsContract.CommonDataKinds.Phone.TYPE_FAX_WORK:
			name = "单位传真";
			break;
		case ContactsContract.CommonDataKinds.Phone.TYPE_FAX_HOME:
			name = "住宅传真";
			break;
		case ContactsContract.CommonDataKinds.Phone.TYPE_PAGER:
			name = "寻呼机";
			break;
		case SIM:
			name = "SIM";
			break;
		default:
			name = "其他";
			break;
		}
    	
    	return name;
    }
    
}